function main(pageId, param) {
    return new Promise((resolve, reject) => {
        debugger

        let unitLitigants = window.unitLitigant || [];

        if (!Array.isArray(unitLitigants) || unitLitigants.length === 0) {
            let nullList = { "hasError": false, "result": [], "message": null, "tag": null, "totalCount": "0", "request_id": "8252sdda6-6988-4ad9-93fe-5b3be2de54b2" };
            resolve(nullList);
        }


        getResData(unitLitigants).then(resData => {
            resolve(resData);
        });

    });
}


//    let litigant = { 'group_id': groupId, 'matter_id': matter_id, 'matter_name': matter_name, 'btnElement': btnElement };
//     window.unitLitigant.push(litigant);
function getResData(unitLitigants) {
    return new Promise((resolve, reject) => {
        let resultData = [];
        for (let i = 0; i < unitLitigants.length; i++) {
            let litigant = unitLitigants[i];
            resultData.push({
                "version": null,
                "data": {
                    "group_id": { "icon": null, "style": null, "value": litigant.groupId },
                    "matter_id": { "icon": null, "style": null, "value": litigant.matter_id },
                    "matter_name": { "icon": null, "style": null, "value": litigant.matter_name }
                }
            });
        }

        let res = {
            "hasError": false,
            "result": resultData,
            "message": null,
            "tag": null,
            "totalCount": unitLitigants.length.toString(),
            "request_id": "8252sdda6-6988-4ad9-93fe-5b3be2de54b2"
        };

        resolve(res);  // 返回结果
    })
}
